<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>OOI</title>
		<script type="text/javascript">
			window.onload = function(){
				var btn = document.getElementById("btn");
				btn.onclick = function(){
					/*生成前先清空(清空最快最犀利的方法)*/
					document.getElementById("dynamic").innerHTML = "";
					var num = parseInt(document.getElementById("num").value);
					for(var i=0;i<num;i++){
						var input = document.createElement("input");
						input.setAttribute("type", "text");
						document.getElementById("dynamic").appendChild(input);
						console.log(input);/*firebug 调试代码  控制台会输出  */
					}
				}
			}
		</script>
	</head>
	<body>
		<br><a href="../index.jsp">back</a>
		<br><hr color="red" />
		<h5>dom动态生成文本框</h5>
		<div>
			<input type="text" size=5 id="num" />
			<input type="button" id="btn" value="Go" />
		</div>
		<div id="dynamic" style="width:30%">
		</div>
	</body>
</html>